/**
 * Created by yuzhou on 2020/3/29.
 */
//获取
$(document).ready(function () {
    // var proportion = parseInt($('.centerdivimg').height()/$('.centerdivimg').width());
    var app = new Vue({
        el: "#app",
        data: {
            imgwidth: "100%",
            imgheight: "100%",
            initialimgwidth: 0,
            initialimgheight: 0,
            //等比宽高
            proportion:0,
            //等位移动
            mobile:0,
            planeride_title_img:"",
            map_img:"",
            f1:"",
            f2:"",
            f3:"",
            f4:"",

            is_shenyang:false,

            tab1:"市场导购",
            tab2:"动态资讯",
            tab3:"联系我们",

            is_en:false
        },
        mounted:function(){
            var self = this;
            var market_id = self.getQueryValue("id");
            if(market_id == 1){
                self.planeride_title_img = "https://www.xinjisx.com/wx/sx.jpg";
                self.map_img = "https://www.xinjisx.com/wx/p2.jpg";
            }else if(market_id == 2){
                self.planeride_title_img = "https://www.xinjisx.com/wx/ht-title.png";
                self.map_img = "https://www.xinjisx.com/wx/p1.jpg";
            }else if(market_id == 3){
                self.is_shenyang= true;
                self.planeride_title_img = "https://www.xinjisx.com/wx/sy-pm.png";
                self.map_img = "https://www.xinjisx.com/wx/p3.jpg";
            }
            self.f1 = "/xj/image/store/1F-1.png";
            self.f2 = "/xj/image/store/2F.png";
            self.f3 = "/xj/image/store/3F.png";
            self.f4 = "/xj/image/store/4F.png";

            var lanuage_type = localStorage.getItem("language");

            if(lanuage_type == "cn"){
                self.tab1 = "市场导购";
                self.tab2 = "动态资讯";
                self.tab3 = "联系我们";
                self.is_en = false;
            }else{
                self.tab1 = "MarketShopping"+"\n"+"Guide";
                self.tab2 = "Dynamic"+"\n"+"Information";
                self.tab3 = "Contact Us";
                self.is_en = true;
            }
        },
        methods: {
            getQueryValue:function (a) {
                var query = decodeURI(window.location.search.substring(1));
                var vars = query.split("&");
                for (var i = 0; i < vars.length; i++) {
                    var pair = vars[i].split("=");
                    if (pair[0] == a) { return pair[1]; }
                }
                return null;
            },

            mousemove: function (event) {
                var that = this;

                var scrpllX = $('.centerdiv').scrollLeft();
                $('.smallcenterdiv').scrollLeft(scrpllX/that.mobile);
                console.log("大："+$('.centerdiv').scrollLeft());
                console.log("小："+scrpllX/that.mobile);


            },
            imageLoaded: function () {
                this.proportion = $('.centerdivimg').height() / $('.centerdivimg').width();
                this.initialimgwidth = $('.centerdivimg').width() ;
                this.initialimgheight = $('.centerdivimg').height() ;
                this.mobile = $('.centerdivimg').width()/$('.smallcenterimg').width();

                console.log("宽高比例：" + this.proportion);
                console.log("等位:"+this.mobile);
                console.log("初始赋值"+this.initialimgwidth);
                console.log("初始赋值"+this.initialimgheight);
            },
            onbig: function () {
                var that = this;
                that.imgwidth = $('.centerdivimg').width() + 100 + "px";
                that.imgheight = $('.centerdivimg').height() + 100 * that.proportion + "px";
                console.log("宽"+that.imgwidth);
                console.log("高"+that.imgheight);
                console.log("比例" + $('.centerdivimg').height() / $('.centerdivimg').width());
                console.log($('.centerdivimg').width());
                console.log($('.centerdivimg').height());
            },
            onsmall: function () {
                var that = this;
                console.log("xxx"+$('.centerdivimg').width());
                console.log("xxx"+that.initialimgwidth);
                if ($('.centerdivimg').width() == that.initialimgwidth) {
                    return;
                }
                else {
                    that.imgwidth = $('.centerdivimg').width() - 100 + "px";
                    that.imgheight = $('.centerdivimg').height() - 100 * that.proportion + "px";
                    console.log(that.imgwidth);
                    console.log(that.imgheight);
                    console.log("比例" + $('.centerdivimg').height() / $('.centerdivimg').width());
                    console.log($('.centerdivimg').width());
                    console.log($('.centerdivimg').height());
                }
            },
            getback:function () {
                window.history.back(-1);
            },

            floor_tab:function (a) {
                var self = this;
                if(a == 1){
                    self.f1 = "/xj/image/store/1F-1.png";
                    self.f2 = "/xj/image/store/2F.png";
                    self.f3 = "/xj/image/store/3F.png";
                    self.f4 = "/xj/image/store/4F.png";
                    self.map_img = "https://www.xinjisx.com/area/sy1.jpg";
                }else if(a == 2){
                    self.f1 = "/xj/image/store/1F.png";
                    self.f2 = "/xj/image/store/2F-1.png";
                    self.f3 = "/xj/image/store/3F.png";
                    self.f4 = "/xj/image/store/4F.png";
                    self.map_img = "https://www.xinjisx.com/area/sy2.jpg";
                }else if(a == 3){
                    self.f1 = "/xj/image/store/1F.png";
                    self.f2 = "/xj/image/store/2F.png";
                    self.f3 = "/xj/image/store/3F-1.png";
                    self.f4 = "/xj/image/store/4F.png";
                    self.map_img = "https://www.xinjisx.com/area/sy3.jpg";
                }else if(a == 4){
                    self.f1 = "/xj/image/store/1F.png";
                    self.f2 = "/xj/image/store/2F.png";
                    self.f3 = "/xj/image/store/3F.png";
                    self.f4 = "/xj/image/store/4F-1.png";
                    self.map_img = "https://www.xinjisx.com/area/sy4.jpg";
                }
            }
        },
        watch: {
            //监视
            imgwidth: function (value) {
                // console.log($('.centerdivimg').height());
                // console.log("监视");
            },
        },


    });
});